package thread.enumandlambda;

/**
 * @Author: wenjingyuan
 * @Date: 2022/10/29/16:36
 * @Description:
 */
public class App {
    public static void main(String[] args) {
       // eachEnum();
        //String color="RED";
        //将字符串转化为枚举实例
       // ColorEnum colorEnum=ColorEnum.valueOf(color);
        //System.out.println(colorEnum);
        ColorEnum colorEnum=ColorEnum.RED;
        ColorEnum colorEnum1=ColorEnum.GREEN;
        ColorEnum colorEnum2=ColorEnum.BLACK;
        int res=colorEnum.compareTo(colorEnum1);
        int res1=colorEnum.compareTo(colorEnum2);
        int res2=colorEnum.compareTo(colorEnum);
        int res3=colorEnum1.compareTo(colorEnum);
        System.out.println("红色对比绿色："+res);
        System.out.println("红色对比黑色"+res1);
        System.out.println("红色对比红色"+res2);
        System.out.println("绿色对比红色"+res3);
    }
    /*
    循环打印所有的枚举类型
     */
    private static void eachEnum() {
        for(ColorEnum item:ColorEnum.values()){
            int enumIdx=item.ordinal();
            System.out.println(item + " "+enumIdx);
        }
    }
}
